package org.jash.shop2202.net

import org.jash.shop2202.entity.BannerEntity
import org.jash.shop2202.entity.CartItem
import org.jash.shop2202.entity.Category
import org.jash.shop2202.entity.Goods
import org.jash.shop2202.entity.Res
import org.jash.shop2202.entity.User
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface ApiService {
    @GET("/goods/category")
    suspend fun getCategory(): Res<List<Category>>
    @POST("/user/loginjson")
    suspend fun login(@Body map: Map<String, String>):Res<User>
    @GET("/goods/info")
    suspend fun getGoodsByCategory(@Query("category_id") category_id:Int,@Query("currentPage") currentPage:Int,@Query("pageSize") pageSize:Int):Res<List<Goods>>
    @GET("/banner/json")
    suspend fun getBanner():Res<List<BannerEntity>>
    @GET("/goods/detail")
    suspend fun getDetail(@Query("goods_id") id:Int):Res<Goods>
    @POST("/goods/addCar")
    suspend fun addCart(@Body map:Map<String, String>):Res<Any?>
    @GET("/goods/selectCar")
    suspend fun getCart():Res<List<CartItem>>
    @POST("/goods/deleteCar")
    suspend fun deleteCart(@Body map: Map<String, Int>):Res<Any?>
}